import Vue from 'vue'
import Vuex from 'vuex';

Vue.use(Vuex);

const store = new Vuex.Store({
    state: {
        uuid: "",
        username: "",
        password: "",
        version: "1.0.39",
        is_login: false,
        is_new_message: false,
        notices: [],
        new_version:false,
        coordinate:{}
    },
    mutations: {
        update_uuid(state, payload) {
            // 变更状态
            state.uuid = payload.uuid;
        },
        updateNew(state, payload) {
           state.is_new_message = payload.is_new_message
        },
        updateNewVersion(state, payload) {
            state.new_version = payload.new_version
        },
        updateLogin(state, payload) {
            state.is_login = payload.is_login
        },
        updateUserInfo(state, payload) {
            state.username = payload.userInfo.username;
            state.password = payload.userInfo.password;
        },
        updateMessage(state, payload) {
            state.notices = payload.notices;
        },
        updateCoordinate(state, payload) {
            state.coordinate = payload.coordinate;
        }
    },
    actions: {}
});
export default store;